package com.joelemon.mockinfluxdbdata.mock.service;

import cn.hutool.core.date.DateTime;
import com.joelemon.mockinfluxdbdata.common.SystemException;
import com.joelemon.mockinfluxdbdata.enums.InsertType;
import com.joelemon.mockinfluxdbdata.mock.InsertStrategy;
import com.joelemon.mockinfluxdbdata.mock.MockConfig;

/**
 * @Description: 默认实现
 * @Author: HJY
 * @Date: 2023/11/30
 */
public abstract class DefaultMockHandleService<T extends MockConfig> implements MockHandleService<T> {

    /**
     * 根据配置判断需要延迟处理
     *
     * @param mockConfig
     * @return
     */
    @Override
    public Long needDalaySeconds(T mockConfig) {
        InsertStrategy insertStrategy = mockConfig.getInsertStrategy();
        if (insertStrategy == null) throw new SystemException("插入策略不存在，系统异常！");
        return insertStrategy.needDalaySeconds();
    }
}
